home *** CD-ROM | disk | FTP | other *** search
- package symantec.itools.db.net;
-
- import java.io.DataOutputStream;
- import java.io.IOException;
- import symjava.lang.Bignum;
- import symjava.sql.SQLException;
-
- public class BigInt extends NumberField {
- long _iVal;
-
- BigInt() {
- }
-
- int getType() {
- return 78;
- }
-
- void readData(ServerObject data) throws SQLException, IOException, ErrorException {
- this._iVal = ((NetData)data).getLong();
- }
-
- void writeData(DataOutputStream os) throws IOException {
- NetData data = new NetData(this._iVal);
- data.write(os);
- }
-
- public String getString() throws SQLException {
- return ((Field)this).isNull() ? null : String.valueOf(this._iVal);
- }
-
- public boolean getBoolean() throws SQLException {
- if (((Field)this).isNull()) {
- return false;
- } else {
- return this._iVal != 0L;
- }
- }
-
- public byte getByte() throws SQLException {
- return ((Field)this).isNull() ? 0 : (byte)((int)this._iVal);
- }
-
- public short getShort() throws SQLException {
- return ((Field)this).isNull() ? 0 : (short)((int)this._iVal);
- }
-
- public int getInt() throws SQLException {
- return ((Field)this).isNull() ? 0 : (int)this._iVal;
- }
-
- public long getLong() throws SQLException {
- return ((Field)this).isNull() ? 0L : this._iVal;
- }
-
- public float getFloat() throws SQLException {
- if (((Field)this).isNull()) {
- return 0.0F;
- } else {
- Float f = new Float((float)this._iVal);
- return f;
- }
- }
-
- public double getDouble() throws SQLException {
- if (((Field)this).isNull()) {
- return (double)0.0F;
- } else {
- Double f = new Double((double)this._iVal);
- return f;
- }
- }
-
- public Bignum getBignum(int scale) throws SQLException {
- return ((Field)this).isNull() ? null : new Bignum(this._iVal, scale);
- }
-
- public void setBoolean(boolean x) throws SQLException {
- if (x) {
- this._iVal = 1L;
- } else {
- this._iVal = 0L;
- }
-
- super._null = false;
- }
-
- public void setByte(byte x) throws SQLException {
- this._iVal = (long)x;
- super._null = false;
- }
-
- public void setShort(short x) throws SQLException {
- this._iVal = (long)x;
- super._null = false;
- }
-
- public void setInt(int x) throws SQLException {
- this._iVal = (long)x;
- super._null = false;
- }
-
- public void setLong(long x) throws SQLException {
- this._iVal = x;
- super._null = false;
- }
-
- public void setFloat(float x) throws SQLException {
- Float f = new Float(x);
- this._iVal = f.longValue();
- super._null = false;
- }
-
- public void setDouble(double x) throws SQLException {
- Double d = new Double(x);
- this._iVal = d.longValue();
- super._null = false;
- }
-
- public void setBignum(Bignum x) throws SQLException {
- this._iVal = x.longValue();
- super._null = false;
- }
-
- public void setString(String x) throws SQLException {
- Integer i = new Integer(x);
- this._iVal = i.longValue();
- super._null = false;
- }
-
- public int getSQLType() {
- return -5;
- }
-
- public Object getObject() throws SQLException {
- return new Long(this._iVal);
- }
-
- public void setObject(Object obj) throws SQLException {
- this.setLong((Long)obj);
- }
- }
-